package com.itheima.a01mycollection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class A04_CollectionDemo4 {
    public static void main(String[] args) {
        //1.创建集合并添加元素
        Collection<String> coll = new ArrayList<>();
        coll.add("aaa");
        coll.add("bbb");
        coll.add("ccc");

        //2.获取迭代器
        Iterator<String> it2=coll.iterator();
        while(it2.hasNext()){
            String str=it2.next();
            if(str.equals("bbb")){
                it2.remove();
            }
        }
        System.out.println(coll);
    }
}
